﻿@{
    ViewBag.Title = "UpdatePwd";
    Layout = "~/Views/Shared/MyAccount.cshtml";
}
<link href="~/Content/BootstrapSouce/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/Content/BootstrapSouce/js/jquery.js"></script>
<script src="~/Content/BootstrapSouce/js/bootstrap.min.js"></script>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script>
    function yan() {
        var pwd = $("#Password1").val();
            $.ajax({
                type: "POST",
                url: "/MemLoan/SelectPayPwd",
                dataType: "json",
                success: function (mes) {
                    if (pwd == mes) {
                        $("#yan").html("")
                        $("#yan").html("✔")
                    }
                    else {
                        if (pwd=="") {
                            $("#yan").html("")
                            $("#yan").html("请输入旧密码")
                        }
                        else {
                            $("#yan").html("")
                            $("#yan").html("密码不正确")
                        }
                    }
                }
            })
    }
    function yanOne() {
        var pwd = $("#Password2").val();
        if (pwd=="") {
            $("#yanOne").html("")
            $("#yanOne").html("请输入新密码")
        }
        else {
            if (pwd.length!=6) {
                $("#yanOne").html("")
                $("#yanOne").html("密码长度不正确")
            }
            else {
                $("#yanOne").html("")
                $("#yanOne").html("✔")
            }
        }
    }
    function yanTwo() {
        var pwd3 = $("#Password3").val();
        var pwd2 = $("#Password2").val();
        if (pwd3 == "") {
            $("#yanTwo").html("")
            $("#yanTwo").html("请再次输入密码")
        }
        else {
            if (pwd2!=pwd3) {
                $("#yanTwo").html("")
                $("#yanTwo").html("两次密码不一致")
            }
            else {
                $("#yanTwo").html("")
                $("#yanTwo").html("✔")
            }
        }
    }
    function Sub() {
        var span1 = $("#yan").html();
        var span2 = $("#yanOne").html();
        var span3 = $("#yanTwo").html();
        var NewPwd = $("#Password2").val();
        if (span1 == "✔" && span2 == "✔" && span3 == "✔") {
            
            $.ajax({
                type: "POST",
                url: "/MemLoan/UpdatePwdDo",
                dataType: "json",
                data:{ pwd: NewPwd },
                success:function (mes) {
                    
                    if (mes>0) {
                        alert("交易修改成功！");
                        location.href = '/MemLoan/MemLoan'
                    }
                }
            })
        }
        else {
            alert("信息有误，修改失败！");
            return;
        }
    }
</script>
    <div style="width:900px; height:660px;">
        <h3 style="font-weight:bold;padding-left:300px;">修改交易密码！</h3><br />
        <div style="margin-left:20px;padding:0">
            <label>&nbsp;&nbsp;&nbsp;旧密码:&nbsp;&nbsp;&nbsp;</label>&nbsp;<input id="Password1" type="password" onblur="yan()" placeholder="请输入旧密码" />&nbsp;<span id="yan" style="color:#ff0000"></span><br /><br />
            <label>&nbsp;&nbsp;&nbsp;新密码:&nbsp;&nbsp;&nbsp;</label>&nbsp;<input id="Password2" type="password" onblur="yanOne()" placeholder="请输入新密码" />&nbsp;<span id="yanOne" style="color:#ff0000"></span><br /><br />
            <label>确认密码:&nbsp;&nbsp;&nbsp;</label>&nbsp;<input id="Password3" type="password" onblur="yanTwo()" placeholder="请确认密码" />&nbsp;<span id="yanTwo" style="color:#ff0000"></span><br /><br />
            <input class="btn-primary" id="Button1" type="button" value="修改" onclick="Sub()" style="margin-left:70px;width:100px;height:35px; border-radius:5px;" />
        </div>
        <div style="margin-left:20px;padding:0;margin-top:120px;">
            <label>温馨提示：</label><br />
            <label>·交易密码必须6位数字、字母、下划线至少两种组成</label><br />
        </div>
    </div>

